<template>
	<section class="jumbotron">
		<h3 class="jumbotron-heading">
			搜索github网站的用户
		</h3>
		<div>
			<input v-model="keyword" type="text" placeholder="输入用户名" />&nbsp;
			<button @click="handleSearch">搜索</button>
		</div>
	</section>
</template>

<script>
	import axios from 'axios'
	export default {
		name: 'Search',
		data() {
			return {
				keyword:''
			}
		},
		methods:{
			async handleSearch(){
				//准备发请求的url
				let url = `https://api.github.com/search/users?q=${this.keyword}`
				//发请求
				let result = await axios.get(url)
				console.log(result.data.items)
			}
		},
		mounted(){
			console.log('@')
		}
	}
</script>